/**
* @author zqp
* @version2017年12月23日 
* @description 
*/
package com.zqp.security.core.authentication;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import com.zqp.security.core.properties.SecurityConstants;

/**
* @author zqp
* @version2017年12月23日 
* @description 密码登录相关的配置
*/
public class AbstractChannelSecurityConfig extends WebSecurityConfigurerAdapter {
	@Autowired
	protected AuthenticationSuccessHandler zqpAuthenticationSuccessHandler;
	
	@Autowired
	protected AuthenticationFailureHandler zqpAuthenticationFailureHandler;
	
	
	protected void applyPasswordAuthenticationConfig(HttpSecurity http) throws Exception {
		http.formLogin()
//		http.httpBasic()
			.loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL)//-->-->转向到自定义的处理方法
			.loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM)
			.successHandler(zqpAuthenticationSuccessHandler)
			.failureHandler(zqpAuthenticationFailureHandler);
	}
}
